C (208/301)

From:Ben Hutchings
Date:20 Aug 99 at 01:13:59
Subject:Re: journey to nil:

From: Ben Hutchings <womble@zzumbouk.demon.co.uk>

On Thu, Aug 19, 1999 at 12:04:44PM +0200, Radoslav Hodnicak wrote:
> From: Radoslav Hodnicak <rh@hysteria.sk>
>
> hello folks.
>
> can anybody please tell me what is neccessary to do to detach a program
> started from shell so the shell can be closed. i have no info about
> dos/proces structure etc. so i'm asking here.
> what is happening when i run >NIL: <NIL: something? and cannot be it done
> after start?

When you do that, a new CLI/shell is spawned in non-interactive
background mode, running the given command.

You cannot easily do *exactly* this once your program has started.
What you can do is (1) use CreateNewProc to start a new process for
your program, then (2) set Cli()->cli_Module = 0, and (3) return from
your original process. Step 2 ensures that the CLI you started from
will not attempt to unload your program. In fact, your program will
never be unloaded! In order to be sure that it does, you will have to
copy some simple code that unloads your program into a separate piece
of memory, and then call this when you really exit. This is tricky,
and that memory can never be freed. Really, this isn't a very good
idea.



Ben Hutchings - womble@zzumbouk.demon.co.uk, http://www.zzumbouk.demon.co.uk
Team *AMIGA* | Jay Miner Society | Linux - the choice of a GNU generation
compatible: Gracefully accepts erroneous data from any source